package com.ax.associator.store.controller;

import com.ax.associator.store.common.ajax.AjaxRes;
import com.ax.associator.store.common.log.LogInfo;
import com.ax.associator.store.common.log.OperateType;
import com.ax.associator.store.common.utils.base.Const;
import com.ax.associator.store.domain.BaseChargeRules;
import com.ax.associator.store.domain.PrescriptionAudit;
import com.ax.associator.store.domain.PrescriptionMast;
import com.ax.associator.store.service.PrescriptionAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/web/auditRecord/")
public class PrescriptionAuditController {

    @Autowired
    private PrescriptionAuditService prescriptionAuditService;

    @RequestMapping("queryPrescription")

    public AjaxRes queryAuditRecord(AjaxRes ajaxRes,@RequestBody Long associatorId){
        try{
            List<PrescriptionAudit> list=prescriptionAuditService.queryAuditRecord(associatorId);
            ajaxRes.setSucceed(list,Const.DATA_SUCCEED);
        }catch (Exception e){
            ajaxRes.setFailMsg(e.getMessage());
        }
        return ajaxRes;
    }

    @RequestMapping("queryMemberTerm")

    public AjaxRes queryMemberTerm(AjaxRes ajaxRes){
        try{
            List<BaseChargeRules> list=prescriptionAuditService.queryMemberTerm();
            ajaxRes.setSucceed(list,Const.DATA_SUCCEED);
        }catch (Exception e){
            ajaxRes.setFailMsg(e.getMessage());
        }
        return ajaxRes;
    }

    @RequestMapping("queryInquiry")

    public AjaxRes queryMemberProfile(AjaxRes ajaxRes,@RequestBody Long associatorId){
        try{
            List<PrescriptionMast> list=prescriptionAuditService.queryMemberProfile(associatorId);
            ajaxRes.setSucceed(list, Const.DATA_SUCCEED);
        }catch (Exception e){
            ajaxRes.setFailMsg(e.getMessage());
        }
        return ajaxRes;
    }
}
